package 算法.leetcode;

/**
 * @author:谢君臣
 * @Date:2021/5/19-8:59
 * @version:1.0
 * @function:
 */
public class lc04 {
    public static void main(String[] args) {
        findNumberIn2DArray(new int[][]{{-5}},-5);
    }
    public static boolean findNumberIn2DArray(int[][] matrix, int target) {
        int i = matrix.length - 1, j = 0;
        while(i >= 0 && j < matrix[0].length)
        {
            if(matrix[i][j] > target) i--;
            else if(matrix[i][j] < target) j++;
            else return true;
        }
        return false;
    }
}
